# Maintainer: Lukas Fleischer <archlinux at cryptocrack dot de>
# Contributor: Emil Renner Berthing <esmil@mailme.dk>
# Contributor: Xiao-Long Chen <chenxiaolong@cxl.epac.to>

pkgname=hdapsd
pkgver=20090401
pkgrel=5
pkgdesc='HDAPS userspace hard drive protection daemon'
arch=('i686' 'x86_64')
url='http://sourceforge.net/projects/hdaps/'
license=('GPL')
depends=('glibc')
backup=('etc/conf.d/hdapsd')
source=("http://downloads.sourceforge.net/hdaps/hdapsd-${pkgver}.tar.gz"
        'hdapsd.conf.d'
        'hdapsd.rc.d'
        'hdapsd.systemd'
        'hdapsd.wrapper')
md5sums=('897cee8b0192febd127470f3e9506aeb'
         '07fc036c8717bf5a38bbc269ed38ad19'
         '9ab70348da9751810a2bbac51e18ac75'
         '4b1378d43dc9431982f6605265c24f3b'
         '11270661f3a543268786a68bbe74a6bb')

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  ./configure --prefix=/usr --sysconfdir=/etc
  make ${MAKEFLAGS}
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  make DESTDIR="${pkgdir}/" install

  # install rc script and its configuration file
  install -Dm0644 "${srcdir}/hdapsd.conf.d" "${pkgdir}/etc/conf.d/hdapsd"
  install -Dm0755 "${srcdir}/hdapsd.rc.d" "${pkgdir}/etc/rc.d/hdapsd"
  install -Dm0644 "${srcdir}/hdapsd.systemd" "${pkgdir}/usr/lib/systemd/system/hdapsd.service"
  install -Dm0755 "${srcdir}/hdapsd.wrapper" "${pkgdir}/usr/sbin/hdapsd-wrapper"
}
